package com.etoak.controller;

import com.etoak.entity.Doctor;
import com.etoak.entity.Schedule;
import com.etoak.entity.ScheduleDTO;
import com.etoak.service.ScheduleService;
import com.etoak.vo.ResultVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 排班
 */
@RestController
@RequestMapping("/schedule")
public class ScheduleController {













































    @Autowired
    ScheduleService scheduleService;

    @PostMapping
    public ResultVO<Object> add(@Validated @RequestBody ScheduleDTO schedule) {
        scheduleService.add(schedule);
        return ResultVO.success();
    }
    @GetMapping("/{doctorId}")
    public ResultVO<List<Schedule>> get(@PathVariable int doctorId) {
        List<Schedule> list=scheduleService.getMessage(doctorId);
        return ResultVO.success(list);
    }
}
